package xyz.jason.mybatisgenerator.vo;


import lombok.Data;
import org.springframework.util.StringUtils;

import java.io.Serializable;

/**
 * @ProjectName: mybatis-generator
 * @Package: xyz.jason.mybatisgenerator.vo
 * @ClassName: DataEntity
 * @Author: Jason · L
 * @Description: 数据库请求参数
 * @Date: 2021/4/6 16:37
 * @Version: 1.0
 */
@Data
public class DataEntity implements Serializable {

    private String dataUrl;

    private String user;

    private String password;

    private String path;

    private String tableName;

    private String author;


    public void check(){
        if(!StringUtils.hasLength(dataUrl) ||
                !StringUtils.hasLength(user) ||
                !StringUtils.hasLength(password) ||
                !StringUtils.hasLength(path) ||
                !StringUtils.hasLength(tableName) ||
                dataUrl.equals("DataUrl") ||
                user.equals("User") ||
                password.equals("Password") ||
                path.equals("Path: xyz.jason") ||
                tableName.equals("TableName: Separated by comma")
        ){
            throw new NullPointerException("必填参数为空");
        }
    }

    public void defaultEntity(){
        this.setDataUrl("DataUrl");
        this.setUser("User");
        this.setPassword("Password");
        this.setPath("Path: xyz.jason");
        this.setTableName("TableName: Separated by comma");
        this.setAuthor("Jason");
    }

}
